﻿using Framework.Remoting.Conventions;

namespace Framework.Remoting.Client
{
    public class ChannelPerRequest : RequestBase
    {
        public ChannelPerRequest() : this(new CachedChannelFactoryFactory())
        {
        }

        public ChannelPerRequest(IChannelFactoryFactory channelFactoryFactory)
            : base(channelFactoryFactory)
        {
        }

        public override T BeginRequest<T>(WcfServiceInfo wcfServiceInfo)
        {
            return CreateChannel<T>(wcfServiceInfo);
        }

        public override void EndRequest<T>(T channel)
        {
            ManageChannel(channel, true);
        }

        public override void Dispose()
        {
        }
    }
}